//****************************************************************
//* Copyright (c) 2004 Ford Motor Company. All Rights Reserved.
//*
//* $$Workfile:   SFIDao.java  $$
//* $$Revision:   1.1  $$
//* $$Author:   JLOPE262  $$
//* $$Date:   Dec 10 2008 15:13:26  $$
//*
//*****************************************************************
package ar.com.ford.it.fullEconomics.persistence.dao;

import java.sql.Timestamp;
import java.util.Collection;
import ar.com.ford.it.fullEconomics.persistence.dto.Ncas003ColorVw;
import ar.com.ford.it.fullEconomics.persistence.dto.Ncas012VehicleVw;
import ar.com.ford.it.fullEconomics.persistence.dto.Ncas104SfiVw;
import ar.com.ford.it.webengine.persistence.PersistenceUtil;
import com.ford.it.logging.ILogger;
import com.ford.it.logging.LogFactory;
import com.ford.it.persistence.PersistenceException;
import com.ford.it.persistence.PersistenceManager;
import com.ford.it.persistence.Query;

public class SFIDao extends Dao {

	private static final String CLASS_NAME = SFIDao.class.getName();

	private static final ILogger log = LogFactory.getInstance().getLogger(
			CLASS_NAME);

	/**
	 * Obtiene los sfi buscados por vehiculo color y fecha.
	 * 
	 * @return
	 * @throws PersistenceException
	 */
	public Collection<Ncas104SfiVw> findSFIByVehicleDateColor(
			Timestamp fechaSFIInicio, Timestamp fechaSFIFin,
			Ncas012VehicleVw vehicleLine, Ncas003ColorVw color)
			throws PersistenceException {

		String METHOD_NAME = "findSFIByVehicleDateColor";
		log.entering(CLASS_NAME, METHOD_NAME);

		Collection<Ncas104SfiVw> resultCol = null;
		PersistenceManager pm = null;

		pm = PersistenceUtil.getPersistenceManager();
		Query query = pm
				.newQuery("findSFIByVehicleDateColor", Ncas104SfiVw.class);

		Object[] parametros = { fechaSFIInicio, fechaSFIFin, vehicleLine,
				color };

		query.setParameterArray(parametros);

		resultCol = (Collection) pm.executeQuery(query);

		log.exiting(CLASS_NAME, METHOD_NAME);
		return resultCol;
	}

	/**
	 * Retorna el objeto pasanod la pk compuesta pro Codigo de SFI y Codigo de
	 * la linea de vehiculo
	 * 
	 * @param pk
	 * @return
	 * @throws PersistenceException
	 */
	public Ncas104SfiVw getSFIByPk(Ncas104SfiVw pk) throws PersistenceException {
		String METHOD_NAME = "getSFIByPk";
		log.entering(CLASS_NAME, METHOD_NAME);

		Ncas104SfiVw result = (Ncas104SfiVw) this.getObjById(pk);
		
		log.entering(CLASS_NAME, METHOD_NAME);
		return result;
	}

}
